import java.awt.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

public class test2 {
    public static void main(String[] args){
        File file = new File("D:/新建文本文档.txt");
        try {
            System.out.println("试图打开 D:/新建文本文档.txt");
            new FileInputStream(file);
            Desktop.getDesktop().open(new File("D:/新建文本文档.txt"));
        } catch (FileNotFoundException e) {
            System.out.println("D:/新建文本文档.txt不存在");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
